package com.study.Util;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 客户端工具
 *
 * @Author hupengming
 * @ClassName
 * @Date 2022-11-11 10:35
 * @Version 1.0
 */
public class ServletUtil {

    /**
     * 把字符串渲染到客户端
     *
     * @param response
     * @param message
     */
    public static void senderString(int status,HttpServletResponse response,String message){
        try {
            response.setStatus(status);
            response.setCharacterEncoding("utf-8");
            response.setContentType("application/json; charset=utf-8");
            response.getWriter().write(message);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
